home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / BeanDescriptor.java < prev    next >
Text File  |  1998-09-22  |  2KB  |  72 lines

  1. /*
  2.  * @(#)BeanDescriptor.java    1.11 98/07/01
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.beans;
  16.  
  17. /**
  18.  * A BeanDescriptor provides global information about a "bean",
  19.  * including its Java class, its displayName, etc.
  20.  * <p>
  21.  * This is one of the kinds of descriptor returned by a BeanInfo object,
  22.  * which also returns descriptors for properties, method, and events.
  23.  */
  24.  
  25. public class BeanDescriptor extends FeatureDescriptor {
  26.  
  27.     /**
  28.      * Create a BeanDescriptor for a bean that doesn't have a customizer.
  29.      * @param beanClass  The Class object of the Java class that implements
  30.      *        the bean.  For example sun.beans.OurButton.class.
  31.      */
  32.     public BeanDescriptor(Class beanClass) {
  33.     this(beanClass, null);
  34.     }
  35.  
  36.     /**
  37.      * Create a BeanDescriptor for a bean that has a customizer.
  38.      * @param beanClass  The Class object of the Java class that implements
  39.      *        the bean.  For example sun.beans.OurButton.class.
  40.      * @param customizerClass  The Class object of the Java class that implements
  41.      *        the bean's Customizer.  For example sun.beans.OurButtonCustomizer.class.
  42.      */
  43.     public BeanDescriptor(Class beanClass, Class customizerClass) {
  44.     this.beanClass = beanClass;
  45.     this.customizerClass = customizerClass;
  46.     String name = beanClass.getName();
  47.     while (name.indexOf('.') >= 0) {
  48.         name = name.substring(name.indexOf('.')+1);
  49.     }
  50.     setName(name);
  51.     }
  52.  
  53.     /**
  54.      * @return The Class object for the bean.
  55.      */
  56.     public Class getBeanClass() {
  57.     return beanClass;
  58.     }
  59.  
  60.     /**
  61.      * @return The Class object for the bean's customizer.  This may
  62.      * be null if the bean doesn't have a customizer.
  63.      */
  64.     public Class getCustomizerClass() {
  65.     return customizerClass;
  66.     }
  67.  
  68.     private Class beanClass;
  69.     private Class customizerClass;
  70.  
  71. }
  72.